import React from 'react';
import { Menu } from 'antd';
import './index.less';

export default function FilterToolTable(props) {
  const handleClick = (item) => {
    props.refreshTableFilter &&
      props.refreshTableFilter({
        [props.name]: item.value,
      });
    props.confirm();
  };
  return (
    <Menu
      className='filter-menu'
      selectedKeys={props.selectedIds.map((it) => it.toString()) || []}
      disabled={props.disabled}
    >
      {props.options.map((item) => {
        return (
          <Menu.Item key={item.value} onClick={handleClick.bind(this, item)} title={item.name}>
            {item.name}
          </Menu.Item>
        );
      })}
    </Menu>
  );
}
